package be.kuleuven.mume.arrayAdapters;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import be.kuleuven.mume.R;
import be.kuleuven.mume.framework.Antwoord;

public class AntwoordArrayAdapter extends ArrayAdapter<Antwoord>{
	private List<Antwoord> antwoorden;
	
	public AntwoordArrayAdapter(Context context, List<Antwoord> objects) {
		super(context, R.layout.rij_simpel, objects);
		antwoorden = objects;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
        if (view == null) {
            LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = vi.inflate(R.layout.rij_simpel, null);
        }
        Antwoord a = antwoorden.get(position);
        if (a != null) {
        	TextView text = (TextView) view.findViewById(R.id.text1);
            if (text != null) {
            	text.setText(a.getText());                            }
        }
        return view;
	}
}
